import type { ProfileDetail, ProfileParams } from '../types/member'
import { http } from '../utils/http'
export const getMemberProfileAPI = () => {
  return http<ProfileDetail>({
    method: 'GET',
    url: '/member/profile',
  })
}

// export const getMemberProfileAPI = () => {
//   return new Promise((resolve, reject) => {
//     uni.request({
//       url: 'https://pcapi-xiaotuxian-front-devtest.itheima.net/member/profile',
//       method: 'GET',
//       header: {
//         Authorization: useMemberStore().profile?.token,
//       },
//       success: (res) => {
//         resolve(res.data)
//       },
//       fail: (err) => {
//         reject(err)
//       },
//     })
//   })
// }

//修改个人信息

//PUT /member/profile

export const updateMemberProfileAPI = (data: ProfileParams) => {
  return http({
    method: 'PUT',
    url: '/member/profile',
    data,
  })
}
